#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class info{
public:
    info(bool T,int minvalue){
        this->T = T;
        this->minvalue = minvalue;
    }
public:
    bool T;
    int minvalue;
};

class Solution {
public:
    bool increasingTriplet(vector<int>& nums) {
        if(nums.size()<3){
          return false;
        }
        info T = func(nums,3);
        return T.T;
    }
    
    info func(vector<int>& nums,int n){
        if(nums.size()<n){
            return info(false,INT16_MAX);
        }
        if(n==1){
            return info(true,*min_element(nums.begin(),nums.end()));
        }
        int startvalue = *nums.begin();
        vector<int> tempnums(nums.begin()+1,nums.end());
        info l = func(tempnums,n-1);
        info r = func(tempnums,n);
        if(r.T==true){
            return info(true,min(startvalue,r.minvalue));
        }
        else if(l.T==true&&startvalue<l.minvalue){
            return info(true,startvalue);
        }
        else{
            int minvalue = min(l.minvalue,r.minvalue);
            return info(false,min(startvalue,minvalue));
        }

    }
};


int main(){
    Solution S;
    vector<int> nums = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
    cout<<S.increasingTriplet(nums)<<endl;
}
